package com.gxa.admin.controller;

import com.gxa.common.vo.*;
import com.gxa.modules.pojo.AuditAdd;
import com.gxa.modules.pojo.Loan;
import com.gxa.modules.pojo.LoanSearch;
import com.gxa.modules.service.BorrowCenterService;
import io.swagger.annotations.*;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/borrowCenter")
@Api(value = "贷前贷中test",tags = "贷前贷中接口API--周军国")
public class BorrowCenterController {
    @Autowired(required = false)
private BorrowCenterService borrowCenterService;
    //贷前管理
   //@RequiresPermissions(value = {"/home/shouxin","/home/firstCheck","/home/recheck"},logical = Logical.OR)
@PostMapping("/beforeCredit")
@ApiOperation(value = "查询准入授信",notes = "准入授信实体",httpMethod = "POST", response = ResultVo.class)
@ApiResponses({
        @ApiResponse(code=200,message="请求成功"),
        @ApiResponse(code=400,message="坏请求"),
        @ApiResponse(code=404,message="找不到页面"),
        @ApiResponse(code=405,message="Method请求错误"),
        @ApiResponse(code=500,message="后台服务错误")
})
    public JsonResult selectBeforeCredit(@RequestBody PageRecv<LoanSearch> pageRecv){
    System.out.println(pageRecv);
        JsonResult jsonResult=new JsonResult();
            jsonResult=borrowCenterService.selectBeforeCredit(pageRecv);
        return jsonResult;
    }
//审核详情查询
    @GetMapping("/allAudit")
    @ApiOperation(value = "审核详情接口",notes = "查询贷款记录对应审核详情",httpMethod = "GET", response = ResultVo.class)
    @ApiImplicitParam(name = "loan_id",value = "贷款主键id",paramType = "query",dataType = "String", required = false)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=400,message="坏请求"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=405,message="Method请求错误"),
            @ApiResponse(code=500,message="后台服务错误")
    })
   //@RequiresPermissions(value = {"/home/shouxin/zhongshen","/home/firstCheck/detailInfo","/home/recheck/detailInfo"},logical = Logical.OR)
    public JsonResult selectAllAudit(long loan_id){
    JsonResult jsonResult=borrowCenterService.selectAllAudit(loan_id);
    return jsonResult;
    }
    //添加审核记录
    @ApiOperation(value = "审核结果提交接口",notes = "",httpMethod = "POST", response = ResultVo.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=400,message="坏请求"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=405,message="Method请求错误"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @PostMapping("/addAudit")
    public ResultVo addAudit(@RequestBody AuditAdd auditAdd){
    ResultVo resultVo=new ResultVo();
    resultVo= borrowCenterService.addAudit(auditAdd);
    return resultVo;
    }
    //添加复审记录
    //添加审记录
}
